 //引入mongoose.js文件
 var mongoose = require("./index")
 //定义schema
 const articleSchema = new mongoose.Schema({
    title: {type: String, require: true},
    content: {type: String, require: true},
    stringcount: {type: String, require: false},
    pic: {type: String, require: false},
    type: {type: String, require: false},
    time: {type: Date, default: Date.now}
}) 
const bannerSchema = new mongoose.Schema({
  url: {type: String, require: true}
}) 
const likeSchema = new mongoose.Schema({
  title: {type: String, require: true},
  text: {type: String, require: false}

}) 
const usersSchema = new mongoose.Schema({
  username: {type: String, require: true},
  password: {type: String, require: true},
  avatar: {type: String, require: false},
  age: {type: String, require: false},
  sex: {type: String, require: false},
  phone: {type: String, require: false},
  desc: {type: String, require: false},
}) 
const Blog = {
  Article: mongoose.model('articleSchema', articleSchema),
  Banner: mongoose.model('bannerSchema', bannerSchema),
  like: mongoose.model('likeSchema', likeSchema),
  users: mongoose.model('usersSchema', usersSchema),
}
 //导出
 module.exports = Blog;
